/*
 * copyright (c) 2013 Blaise-Florentin Collin
 *
 * This file is part of astroDCAM.
 *
 * AstroAviBrowser is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v3
 * as published by the Free Software Foundation
 *
 * AstroAviBrowser is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * v3 along with AstroAviBrowser; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA
 */

///
/// \file QAstroMainWindow.cpp
///
/// \brief Main GUI object (code)
///

// C++ app includes
#include "config.hpp"

// Qt app includes
#include "QAstroMainWindow.hpp"

QAstroMainWindow::QAstroMainWindow(dc1394bus* bus,QApplication* a, QWidget* parent) : QWidget(parent) {
   // init
   app=a;
   mainBus=bus;
}

//
// Builds the GUI
//
int QAstroMainWindow::buildGUI() {
   // set the title
   setWindowTitle(QString(APP_NAME)+QString(" ")+QString(BINARY_VERSION));
   // layout
   layout=new QHBoxLayout(this);
   setLayout(layout);

   // building the tab widget
   mainSettings=new QAstroMainSettings();
   layout->addWidget(mainSettings);
   // building the frame display widget
   mainFrame=new QAstroFrameDisplay(this);
   layout->addWidget(mainFrame);

   // adding the tabs
   cameraTab=new QAstroCameraTab(mainBus);
   mainSettings->addTab(cameraTab,QString(tr("Camera")));
   recordTab=new QAstroRecordTab();
   mainSettings->addTab(recordTab,QString(tr("Record")));
   settingsTab=new QAstroSettingsTab();
   mainSettings->addTab(settingsTab,QString(tr("Settings")));
   cameraTab->buildGUI();
   recordTab->buildGUI();
   settingsTab->buildGUI();
   mainSettings->adjustSize();

   // resize the main window
   adjustSize();
}
